package laos.src;


import laos.src.R;
import android.app.Activity;
import android.content.Intent;
import android.graphics.Typeface;
import android.os.Bundle;
import android.view.View;
import android.view.WindowManager;
import android.view.View.OnClickListener;
import android.widget.TextView;

public class MainMenu extends Activity implements OnClickListener {

	public static Typeface tf , tf2;

	protected static TextView play, instructions, options,
			about, exit;

	private void getViews() {
		play = (TextView) findViewById(R.id.btPlay);
		//joinRoom = (TextView) findViewById(R.id.btJoinRoom);
		instructions = (TextView) findViewById(R.id.btInstructions);
		options = (TextView) findViewById(R.id.btOptions);
		about = (TextView) findViewById(R.id.btAbout);
		exit = (TextView) findViewById(R.id.btExit);
	}

	private void setFonts() {
		tf = Typeface.createFromAsset(getAssets(), "data/fonts/ARCADE.TTF");
		tf2 = Typeface.createFromAsset(getAssets(), "data/fonts/ARCADECLASSIC.TTF");
		play.setTypeface(tf2);
		//joinRoom.setTypeface(tf);
		instructions.setTypeface(tf2);
		options.setTypeface(tf2);
		about.setTypeface(tf2);
		exit.setTypeface(tf);
	}

	private void setOnClickListeners() {
		//createRoom.setOnClickListener(this);
		play.setOnClickListener(this);
		instructions.setOnClickListener(this);
		options.setOnClickListener(this);
		about.setOnClickListener(this);
		exit.setOnClickListener(this);
	}

	/** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		getWindow().setFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON,
				WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
		setContentView(R.layout.main);
		getViews();
		setFonts();
		setOnClickListeners();

	}

	@Override
	protected void onResume() {
		super.onResume();
		Music.play(this, R.raw.game);
	}

	@Override
	protected void onPause() {
		super.onPause();
		Music.stop(this);
	}

	@Override
	public void onClick(View v) {
		switch (v.getId()) {

		/*case R.id.btCreateRoom:
			startActivity(new Intent(this, CreateRoom.class));
			break;*/

		case R.id.btPlay:
			startActivity(new Intent(this, Play.class));
			break;

		case R.id.btInstructions:
			startActivity(new Intent(this, Instructions.class));
			break;

		case R.id.btOptions:
			startActivity(new Intent(this, Options.class));
			break;

		case R.id.btAbout:
			startActivity(new Intent(this, About.class));
			break;

		case R.id.btExit:
			finish();
			break;
		}

	}
}